/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import exception.DuplicateConstraintException;
import exception.ExceptionInterceptor;
import exception.RemoveConstraintException;
import java.io.Serializable;
import java.util.List;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.inject.Named;
import javax.interceptor.Interceptors;
import model.dao.MotivoDao;
import model.entidades.Motivo;

/**
 *
 * @author helton
 */
@Named
@Stateless
@Interceptors(ExceptionInterceptor.class)
public class MotivoController implements Serializable {

    @Inject
    MotivoDao motivoDao;

    public Motivo insert(Motivo motivo) throws DuplicateConstraintException {
        motivoDao.insert(motivo);
        return motivo;
    }

    public Motivo update(Motivo motivo) throws DuplicateConstraintException {
        motivoDao.update(motivo);
        return motivo;
    }

    public void remove(Motivo motivo) throws RemoveConstraintException {
        motivoDao.delete(motivo);
    }

    public List<Motivo> getAll() {
        return motivoDao.getAll();
    }
}
